# -*- coding:utf-8 -*-
from PySide.QtCore import *
from PySide.QtGui import *
import sys
import os

MY_SETTING = QSettings("MY_SETTING")
LAST_PID = MY_SETTING.value("PID")

class MySysTray(QMainWindow):
    def __init__(self,parent=None):
        super(MySysTray, self).__init__(parent)
        MY_SETTING.setValue("PID",os.getpid())

if __name__ == '__main__':
    app = QApplication(sys.argv)
    info = os.system("tasklist | findstr %s"%(str(LAST_PID)))
    print("info",info)
    if info != 1:
        QMessageBox.critical(None,"Systray",u"已有进程存在，进程PID："+unicode(info))
        print "info",info
    else:
        window = MySysTray()
        window.show()
        sys.exit(app.exec_())
